<?php error_reporting(0) ;
ini_set("display_errors", 0 );
?>
<form id="formDadosFuncionario">
    <h3 style="color:#333333">Funcion&aacute;rio  - Matr&iacute;cula (<?= $matricula ?>)</h3><br />
        <br />
   		<fieldset >
        <legend style="size:auto; font-weight:bold; color:#333333">Dados B&aacute;sicos</legend>
        
    <br />
        <table width="746" >
          <tr>
            <td colspan="2">Nome<span id="msg_nome" style="color: #cd0a0a;">*</span></td>
            <td width="12%">CPF</td>
            <td width="9%">Admiss&atilde;o<span id="msg_dt_matricula" style="color: #cd0a0a; ">*</span></td>
            <td width="19%">Dt Afast.</td>
            <td width="13%">Dt Nascimento<span id="msg_dt_nasc" style="color: #cd0a0a;">*</span></td>
          </tr>
          <tr>
              <td colspan="2"><input type="text" size="35" id="nomeFunc" value="<?= $nome ?>" /></td>
            <td><input type="text" id="cpfFunc" size="12" maxlength="14" onkeypress="javascript: mascara(this,cpf)"  value="<?= @$cpf ?>" /></td>
            <td><input type="text" size="9" id="dataAdmissaoFunc" class="datepicker"  value="<?= $dataAdmissao ?>" /></td>
            <td><input type="text" size="9" id="dataAfastamento" class="datepicker" value="<?= @$dataAfastamento ?>"  /></td>
            <td><input type="text" size="9" id="dataNascFunc" class="datepicker" value="<?= $dataNascimento ?>"   /></td>
          </tr>
<tr>
            <td colspan="2">E-Mail</td>
            <td>RG<span id="msg_rg" style="color: #cd0a0a; "></span></td>
            <td>&Oacute;rgao Exp</td>
            <td>UF Exp</td>
            <td width="13%">Dt Emiss&atilde;o.</td>
          </tr>
          <tr>
            <td colspan="2"><input type="text" size="35" id="emailFunc" value="<?= $email?>"   /></td>
            <td><input type="text" id="rgFunc" size="10" maxlength="15" value="<?= $identidade ?>" /></td>
            <td><input type="text" id="orgaoExpRgFunc" size="6" maxlength="10" value="<?= $expedidorIdt ?>" /></td>
            <td>
                <select id="ufExpRgFunc">
                    <option value="<?= $ufExpedidorIdt ?>"><?= $siglaUf ?></option>
                    <?php $this->load->view('uf/cbo_uf'); ?>
                </select>            </td>
            <td><input type="text" size="10" id="dataEmissaoFunc" class="datepicker"  value="<?= $dataExpIdt ?>" /></td>
          </tr>
      <tr>
         <td width="32%" >Naturalidade</td>
         <td width="15%" >Origem &Eacute;tnica</td>
         <td colspan="3" >Estado Civil<span id="msg_estado_civil" style="color: #cd0a0a;">*</span></td>
        <td >Sexo <span id="msg_sexo" style="color: #cd0a0a; ">*</span></td>
        </tr>
      <tr>  
      	<td>
            <select name="cNaturalCidade" id="cNaturalCidade">
                <option value="<?= $cidadeNaturalCod ?>"><?= $naturalidade ?></option>
                <?php $this->load->view('aluno/inc/cbo_cidade'); ?>
            </select>
        </td>
            <td>
                <select name="cOrigemEtnicaFunc" id="cOrigemEtnicaFunc">
                    <option value="<?= $origemEtnicaCod ?>"><?= $origemEtnica ?></option>
                    <option value="1">Branca</option>
                    <option value="2">Ind&iacute;gena</option>
                    <option value="3">Parda</option>
                    <option value="4">Negra</option>
                    <option value="5">Oriental</option>
                </select></td>
            <td colspan="3"><select name="cEstadoCivil" id="cEstadoCivil">
                <option value="<?= $estadoCivilCod ?>"><?= $estadoCivil ?></option>    
                <option value='1'>Solteiro</option>
                <option value='2'>Casado</option>
                <option value='3'>Vi&uacute;vo</option>
                <option value='4'>Desquitado</option>
                <option value='5'>Separado(a) Judicialmente</option>
              </select></td>
            <td><select name="cSexo" id="cSexo">
              <option value="<?= $sexoCod ?>"><?= $sexo ?></option>         
              <option value="1">Feminino</option>
              <option value="2">Masculino</option>
            </select></td>
          </tr>
        </table>
<br /><br />
</fieldset>
<br />
        <fieldset >
        <legend style="size:auto; font-weight:bold; color:#333333">Endere&ccedil;o/Telefones</legend>
    <br />
        <table width="740" >
          <tr>
            <td width="14%">CEP<span id="msg_cep" style="color: #cd0a0a; ">*</span></td>
            <td>Logradouro<span id="msg_logradouro" style="color: #cd0a0a; ">*</span></td>
            <td>Complemento</td>
          </tr>
          <tr>
            <td><input type="text" size="8" id="cCep" value="<?= $cep ?>" /></td>
            <td><input type="text" size="50" id="cLogradouro" value="<?= $logradouro ?>" /></td>
            <td><input type="text" size="23" id="cComplemento" value="<?= $complemento ?>" /></td>
          </tr>
        </table>
<table width="740" >
<tr>
            <td width="33%">Bairro<span id="msg_bairro" style="color: #cd0a0a; ">*</span></td>
        <td width="39%">Cidade<span id="msg_cidade" style="color: #cd0a0a;">*</span></td>
            <td width="5%">UF<span id="msg_uf" style="color: #cd0a0a;">*</span></td>
        <td width="23%">Tipo Endere&ccedil;o</td>
      </tr>
          <tr>
            <td><input type="text" size="30" id="cBairro" value="<?= $bairro?>" /></td>
            <td><input type="text" size="35" id="cCidade" value="<?= $cidade ?>" /></td>
            <td><input type="text" size="3" id="cUf"   value="<?= $uf?>" /></td>
            <td>
                <select name="tipoEndereco"  id="cTipoEndereco">
                  <option value='0'></option>
                  <option value='1'>Residencial</option>
                  <option value='2'>Comercial</option>
              </select>
            </td>
          </tr>
          <tr>
            <td width="12%">Tel Residencial<span id="msg_tel_res" style="color: #cd0a0a; ">*</span></td>
            <td width="12%">Tel Celular<span id="msg_tel_cel" style="color: #cd0a0a; ">*</span></td>
            <td width="12%">&nbsp;</td>
            <td width="12%">&nbsp;</td>
          </tr> 
          <tr>
            <td><input type="text" size="14" onkeypress="javascript: mascara(this,telefone)" id="cTelefoneFunc" maxlength="14"  value="<?= $foneFixo ?>" /></td>
            <td><input type="text" size="14"  onkeypress="javascript: mascara(this,telefone)" id="cTelefoneFunc" maxlength="14"  value="<?= $foneCelular ?>" /></td>
            <td width="12%">&nbsp;</td>
            <td width="12%">&nbsp;</td>
          </tr> 
        </table>
<br /><br />
</fieldset>
<br />
<fieldset >
        <legend style="font-weight:bold; color:#333333">Dados Administrativos</legend>  

    <br />
        <table width="755" >
           <tr>
              <td colspan="9">Loca&ccedil;&atilde;o:
                <select name="cLocacao" id="cLocacao">
                <option value='0'></option>
                <option value='1'>Col&eacute;gio Rogacionista Guar&aacute; - DF</option>
                </select></td>
           </tr>  
          <tr>
            <td colspan="4">Cargos<img id="imgBuscaCargo" alt="1" src="<?php echo base_url() . 'assets/images/ico_view.png' ?>" border="0" title="Busca Cargo" /></td>
            <td colspan="3">Avalia&ccedil;&atilde;o<img id="imgBuscaAval" alt="1" src="<?php echo base_url() . 'assets/images/ico_view.png' ?>" border="0" title="Busca Avaliação"  /></td>
            <td colspan="2">Vale Transporte</td>
          </tr> 

          <tr>
              <td colspan="4"><div id="novoCargoFunc">
                      
                <div id="cCargo"></div>
                <div id="cCargoVazio">
                    <?php 
                        if(!$listaCargos) echo '<b>- Nenhum cargo registrado.</b>';
                    ?>
                </div>
                
              </div></td>
              <td colspan="3" valign="top"><input type="text" size="20"  id="cAvaliacao" /></td>
            <td colspan="2" valign="top">
                <select name="cValeFunc" id="cValeFunc">
                    <option value='<?= $opValeTrasporte ?>'><?= $opValeTrnpDesc ?></option>
                    <option value='1'>Sim</option>
                    <option value='2'>N&atilde;o</option>
            </select></td>
          </tr>
          <tr><td colspan="9">&nbsp;</td></tr>
          <tr >
              <td width="7%">
                <div id="td_vale_transp10" align="right">Dias da Semana:</div>
              </td>
              <td width="3%">
                  <div id="td_vale_transp11"><input type="text" id="input" size="3" <?= @$diasSemana ?>/></div></td>
              <td width="12%">
                <div id="td_vale_transp12" align="right">Tipo Vale 1:</div>
              </td>
        <td width="24%">
<div id="td_vale_transp13">
                      <select name="tipoVale" id="tipoVale1">
                        <option value="<?= @$tipoValeUm ?>"><?= @$tipoValeUm ?></option>
                        <option value="A">A</option>
                        <option value="B">B</option>
                        <option value="C">C</option>
                      </select>
                  </div>
              </td>
          <td width="13%">
            <div id="td_vale_transp14" align="right">Tipo Vale 2: </div>
              </td>
        <td width="15%">
<div id="td_vale_transp15">
                      <select name="tipoVale3" id="tipoVale2">
                        <option value="<?= @$tipoValeDois ?>"><?= @$tipoValeDois ?></option>
                        <option value="A">A</option>
                        <option value="B">B</option>
                        <option value="C">C</option>
                      </select>
                  </div>
              </td>
<td colspan="2">
                  <div id="td_vale_transp16" align="right">Tipo Vale 3:</div>
              </td>
              <td width="12%">
<div id="td_vale_transp17">
                      <select name="tipoVale2" id="tipoVale3">
                        <option value="<?= @$tipoValeTres ?>"><?= @$tipoValeTres ?></option>
                        <option value="A">A</option>
                        <option value="B">B</option>
                        <option value="C">C</option>
                      </select>
                  </div>
              </td>
          </tr>
          <tr>
              <td>
                 <div id="td_vale_transp18" align="right">N&ordm; dias &uacute;teis: </div>
              </td>
              <td>
                 <div id="td_vale_transp19"><input type="text" id="qtdDias" size="3" value="<?= @$qtdDias ?>"/></div>
             </td>
              <td>
                <div id="td_vale_transp20" align="right">Qtd Vale 1: </div>
              </td>
              <td><div id="td_vale_transp21"><input type="text" id="qtdVale1" size="3" value="<?= @$qtdValeUm ?>"/></div></td>
              <td>
                  <div id="td_vale_transp22" align="right">Qtd Vale 2: </div>
              </td>
              <td><div id="td_vale_transp23"><input type="text" id="qtdVale2" size="3" value="<?= @$qtdValeDois ?>"/></div></td>
              <td colspan="2">
                  <div id="td_vale_transp24" align="right">Qtd Vale 3:</div>
              </td>
              <td>
                  <div id="td_vale_transp25">
                      <input type="text" id="qtdVale3" size="3" value="<?= @$qtdValeTres ?>"/>
                  </div>
              </td>
          </tr>
        </table>
<br />
  </fieldset>
        
<br />
<input type="hidden" id="funcionarioId" value="<?= $funcionarioId ?>" />
<input type="button" value="Atualizar Dados" id="btnAtualizarFuncionario" onclick="atualizarFuncionario()"/>
<br /><br /><br />
</form>
<script>
    $(document).ready(
        function(){
            
            var vt = jQuery('select[id="cValeFunc"]').val();
               
               if(vt == 1){
                   $("#td_vale_transp10").css('display','block');
                   $("#td_vale_transp11").css('display','block');
                   $("#td_vale_transp12").css('display','block');
                   $("#td_vale_transp13").css('display','block');
                   $("#td_vale_transp14").css('display','block');
                   $("#td_vale_transp15").css('display','block');
                   $("#td_vale_transp16").css('display','block');
                   $("#td_vale_transp17").css('display','block');
                   $("#td_vale_transp18").css('display','block');
                   $("#td_vale_transp19").css('display','block');
                   $("#td_vale_transp20").css('display','block');
                   $("#td_vale_transp21").css('display','block');
                   $("#td_vale_transp22").css('display','block');
                   $("#td_vale_transp23").css('display','block');
                   $("#td_vale_transp24").css('display','block');
                   $("#td_vale_transp25").css('display','block');
                   
               } else {
                   $("#td_vale_transp10").css('display','none');
                   $("#td_vale_transp11").css('display','none');
                   $("#td_vale_transp12").css('display','none');
                   $("#td_vale_transp13").css('display','none');
                   $("#td_vale_transp14").css('display','none');
                   $("#td_vale_transp15").css('display','none');
                   $("#td_vale_transp16").css('display','none');
                   $("#td_vale_transp17").css('display','none');
                   $("#td_vale_transp18").css('display','none');
                   $("#td_vale_transp19").css('display','none');
                   $("#td_vale_transp20").css('display','none');
                   $("#td_vale_transp21").css('display','none');
                   $("#td_vale_transp22").css('display','none');
                   $("#td_vale_transp23").css('display','none');
                   $("#td_vale_transp24").css('display','none');
                   $("#td_vale_transp25").css('display','none');
               }
            
           $('#cValeFunc').change(function(){
               
               var vt = jQuery('select[id="cValeFunc"]').val();
               
               if(vt == 1){
                   $("#td_vale_transp10").css('display','block');
                   $("#td_vale_transp11").css('display','block');
                   $("#td_vale_transp12").css('display','block');
                   $("#td_vale_transp13").css('display','block');
                   $("#td_vale_transp14").css('display','block');
                   $("#td_vale_transp15").css('display','block');
                   $("#td_vale_transp16").css('display','block');
                   $("#td_vale_transp17").css('display','block');
                   $("#td_vale_transp18").css('display','block');
                   $("#td_vale_transp19").css('display','block');
                   $("#td_vale_transp20").css('display','block');
                   $("#td_vale_transp21").css('display','block');
                   $("#td_vale_transp22").css('display','block');
                   $("#td_vale_transp23").css('display','block');
                   $("#td_vale_transp24").css('display','block');
                   $("#td_vale_transp25").css('display','block');
                   
               } else {
                   $("#td_vale_transp10").css('display','none');
                   $("#td_vale_transp11").css('display','none');
                   $("#td_vale_transp12").css('display','none');
                   $("#td_vale_transp13").css('display','none');
                   $("#td_vale_transp14").css('display','none');
                   $("#td_vale_transp15").css('display','none');
                   $("#td_vale_transp16").css('display','none');
                   $("#td_vale_transp17").css('display','none');
                   $("#td_vale_transp18").css('display','none');
                   $("#td_vale_transp19").css('display','none');
                   $("#td_vale_transp20").css('display','none');
                   $("#td_vale_transp21").css('display','none');
                   $("#td_vale_transp22").css('display','none');
                   $("#td_vale_transp23").css('display','none');
                   $("#td_vale_transp24").css('display','none');
                   $("#td_vale_transp25").css('display','none');
               }
                   
               
           }); 

           $('#cep').change(function(){

                jQuery.ajax( {
                    type: "POST",
                    url: '?c=c_aluno&m=buscaEndereco',
                    cache: false,
                    data: {cep:jQuery('input[id="cep"]').val()},
					
                    beforeSend: function (){
                            jQuery('#btnAtualizarAluno').attr("disabled",true);
                            jQuery('#div_body').addClass("div_carregando");
                            jQuery('#logradouro').attr('readonly', true);
                            jQuery('#bairro').attr('readonly', true);
                            jQuery('#cidade').attr('readonly', true);
                            jQuery('#uf').attr('readonly', true);
                    },
                    complete:  function(){
                           jQuery('#div_body').removeClass("div_carregando");
                           jQuery('#btnAtualizarAluno').attr("disabled",false);
                        },
                    success: function(data){
                        
                        var dados = data.split('@');
                       
                        if(dados[0] == 1){
						
                            jQuery('#logradouro').attr('value', dados[1]);
                            jQuery('#bairro').attr('value', dados[2]);
                            jQuery('#cidade').attr('value', dados[3]);
                            jQuery('#uf').attr('value', dados[4]);

                        } else if(dados[0] == 2){
						
                            jQuery('#cidade').attr('value', dados[1]);
                            jQuery('#uf').attr('value', dados[2]);
							
                        } else {
						
                                jQuery('#logradouro').attr('readonly', false);
                                jQuery('#bairro').attr('readonly', false);
                                jQuery('#cidade').attr('readonly', false);
                                jQuery('#uf').attr('readonly', false);

                        }
                        
                    }
                });

            });
            
            $('#imgBuscaCargo').click(function(){

                jQuery.ajax( {
                    type: "POST",
                    url: '?c=c_cargos&m=listarCargos',
                    cache: false,
                    			
                    beforeSend: function (){
                            jQuery('#div_novo_func').addClass("div_carregando");
                            
                    },
                    complete:  function(){
                           jQuery('#div_novo_func').removeClass("div_carregando");
                           
                        },
                    success: function(data){
                        
                        jQuery.facebox(data);
                        
                    }
                });

            });
        });
</script>
